//
//  MarryToolCell.m
//  BaseProject
//
//  Created by 王洋 on 2020/12/4.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "MarryToolCell.h"

@implementation MarryToolCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
        [self pp_clipCorners:UIRectCornerAllCorners radius:8];
    });
}

- (void)fillCellWithModel:(MarryToolModel *)model {
    
    self.itemTitleLab.text = model.title;
    self.itemSubTitleLab.text = model.subTitle;
    
    if ([model.img isKindOfClass:[NSString class]] && model.img.length > 0) {
        
        if ([model.img hasPrefix:@"http"]) {
            [self.itemImgV sd_setImageWithURL:[NSURL URLWithString:model.img] placeholderImage:[UIImage imageNamed:@"placeholder"]];
        } else {
            [self.itemImgV setImage:[UIImage imageNamed:model.img]];
        }        
    }
    
}

@end
